<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=\, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function Animal() {
            this.sex = ''
            this.eat = function () {
                console.log('吃饭')
            }
        }
        function Humen(name, age) {
            this.name = name
            this.age = age
            return function demo10() { }
        }
        var xiaoming = new Humen('小明', 10)
        console.log(xiaoming)
        //构造函数中return基础数据类型,返回的结果是由this组成的对象
        //构造函数中return引用数据类型,返回这个引用数据类型

        //构造函数定义 == 字面量定义

        //对象  toString  valueOf
        //字符串String  数字Number 对象Object 数组Array 函数Function 布尔值Boolean ......   prototype


        var str1 = 'abc'
        var num1 = 100
        var bool = true
        var arr1 = [1, 2, 3]
        var obj = {}
        var demo = function () { }

        console.log(str1.constructor) //ƒ String() { [native code] }
        console.log(num1.constructor) //ƒ Number() { [native code] }
        console.log(bool.constructor) //f Boolean() { [native code] }
        console.log(arr1.constructor) //ƒ Array() { [native code] }
        console.log(obj.constructor)  //ƒ Object() { [native code] }
        console.log(demo.constructor) //f Function() { [native code] }

        //typeof主要用于判断基础数据类型的类型
        //instanceof主要应用于引用数据类型的判断
        //constructor可以判断所有的数据类型

    </script>
</body>

</html>